<div class="headerFrame">
    <div>{$lang.headerT1}</div>
    <div class="cB"></div>
    <img class="logo" src="image/logo.gif" alt="">
    <form action="./" method="get" id="langForm" name="langForm">
    <input type="hidden" name="lang" value="">
    <div class="lang">
        <img class="flag" name="en" src="image/englandFlag.gif" alt="">
        <img class="flag" name="jp" src="image/japanFlag.gif" alt="">
    </div>
    </form>
    <div class="title">
        <h2>{$lang.headerT2}</h2>
    </div>
</div>
<div class="menuFrame">
    <ul class="menu-bar" sizset="false">
        <li {if $method=="index"}class="active"{/if}>
            <a href="/">
                <span class="iconHome"></span>
                {$lang.headerMenu1}
            </a>
        </li>
        <li {if $method=="apply"}class="active"{/if}>
            <a href="apply">
                <span class="iconApply"></span>
                {$lang.headerMenu2}
            </a>
        </li>
        <li {if $method=="jobList"}class="active"{/if}>
            <a href="jobList">
                <span class="iconJob"></span>
                {$lang.headerMenu3}
            </a>
        </li>
        <li {if $method=="contact"}class="active"{/if}>
            <a href="contact">
                <span class="iconContact"></span>
                {$lang.headerMenu4}
            </a>
        </li>
    </ul>
</div>
<div class="searchFrame">
    <div class="searchMenu">
        <form action="jobList" method="get" name="searchForm">
            <input type="hidden" name="mode" value="search">
            {assign var=key value="search_job_title"}
            <input type="text" style="width: 220px;" placeholder="{$lang.headerSearchF1}" name="{$key}" value="{$arrForm[$key].value}" autocomplete="off" class="textBox" autosuggest="on">
            {assign var=key value="search_salary"}
            <input type="text" style="width: 110px;" placeholder="{$lang.headerSearchF2}" name="{$key}" value="{$arrForm[$key].value}" autocomplete="off" class="textBox">
            {assign var=key value="search_pref_id"}
            {html_options class="selectBox" name=$key options=array("-- `$lang.headerSearchF3` --")+$config.pref selected=$arrForm[$key].value}
            
            {assign var=key value="search_category_id"}
            {html_options class="selectField selectBox" name=$key options=array("-- `$lang.headerSearchF4` --")+$category selected=$arrForm[$key].value}
            {if empty($arrForm[$key].value)}
                {assign var=key value="search_field_id"}
                {html_options id='field' class="selectBox" name=$key options=array("-- `$lang.headerSearchF5` --")}
            {else}
                {assign var=categoryId value=$arrForm[$key].value}
                {assign var=categoryName value=$category[$categoryId]}
                
                {assign var=key value="search_field_id"}
                {html_options id='field' class="selectBox" name=$key options=array("`$lang.all_in``$categoryName`")+$field selected=$arrForm[$key].value}
            {/if}
            <button name="" value="1" type="submit" class="button">{$lang.headerSearchF6}</button>
        </form>
    </div>
</div>
<script type="text/javascript">
$(document).ready(function($) {
    $(".flag").click(function() {
        var lang = $(this).attr('name');
        $("#langForm > input[name=lang]").val(lang);
        $("#langForm").submit();
    });

    $(".selectField").change(function() {
        var htmlStr     = '<option value="">-- {$lang.headerSearchF5} --</option>';
        var category_id = $(this).val();
        if(category_id != 0) {
            var text    = $(".selectField option:selected").text();
            var htmlStr = '<option value="">{$lang.all_in}'+text+'</option>';
        }
        $.ajax({
            url: "/selectField",
            method: "GET",
            async: false,
            data: ({ id : category_id }),
            dataType: 'json',
            success: function(data) {
                $.each(data, function(k, v){
                    htmlStr += '<option value="'+v.field_id+'">'+v.field_name+'</option>';
                });
            }
        });
        $("#field").empty();
        $("#field").append(htmlStr);
    });
});
</script>